{	Problem: http://codeforces.ru/problemset/problem/60/A
	Verdict: Accepted

}
var n,i,l,r,m:longint; s:string;
begin
readln(n,m);
l:=1;
r:=n;
for i:=1 to m do begin
  readln(s);
  if pos('right',s)<>0 then begin
    Delete(s,1,pos('of',s)+2);
    l:=max(strtoint(s)+1,l);
  end else begin
    Delete(s,1,pos('of',s)+2);
    r:=min(strtoint(s)-1,r);
  end;
end;
if l>r then writeln(-1) else writeln(abs(r-l+1));
readln;
end.
